﻿CREATE TABLE [dbo].[Lead]
(
	LeadKey INT NOT NULL Identity(1,1) 
		CONSTRAINT PK_Lead PRIMARY KEY,
	Title nvarChar(127) NOT NULL,
	OwnerKey INT NULL 
		Constraint FK_Lead_OwnerKey REFERENCES Editor(EditorKey),
	CreatedByKey INT NOT NULL 
		Constraint FK_Lead_CreatedByKey REFERENCES Editor(EditorKey),
	CreatedDate DateTimeOffset NOT NULL 
		CONSTRAINT D_Lead_CreatedDate DEFAULT (GetDate()),
	UpdatedByKey INT NOT NULL 
		Constraint FK_Lead_UpdatedByKey REFERENCES Editor(EditorKey),
	UpdatedDate DateTimeOffset NOT NULL 
		CONSTRAINT D_Lead_UpdatedDate DEFAULT (GetDate()),
	LeadTypeKey INT NOT NULL 
		CONSTRAINT FK_Lead_LeadTypeKey REFERENCES LeadType(LeadTypeKey)
		CONSTRAINT D_Lead_LeadTypeKey DEFAULT(0),
	LeadStatusKey INT NOT NULL 
		CONSTRAINT FK_Lead_LeadStatusKey REFERENCES LeadStatus(LeadStatusKey)
		CONSTRAINT D_Lead_LeadStatusKey DEFAULT(0)
)
